/**
 * @Author: Nico
 */
import { findPrevParent } from '@ve/utils/utils'
//必须带done回调 执行完成调用
export default function pdaCloseLayer({ vm, action, done }) {
  // 这里是array 但是是单选 就默认取0
  if (action.extension.layer.value.length > 0) {
    let layerId = action.extension.layer.value[0]
    let getNowPageData = vm.$store.getters['preview/getNowPageData']
    //查找图层id的父级
    let parentObj = findPrevParent([getNowPageData], layerId, '_id', 'list')

    if (parentObj) {
      parentObj.hasSubPageShow = false
      // parentObj.data = {}
      parentObj.subPage.info.data.requestData = {}
      parentObj.subPage.info = {}
    }
  }
  done(null, {})
}
